package top.xunfong.probe.controller;

import top.xunfong.common.core.domain.R;
import top.xunfong.api.probe.domain.dto.ProbeDTO;
import top.xunfong.probe.service.ProbeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;

@RestController
@RequestMapping(value = "/probe")
public class ProbeController {

    @Autowired
    private ProbeService probeService;

    @PostMapping(value = "/single")
    public R<String> sendSingle(@RequestBody ProbeDTO dto) {
        probeService.saveProbe(dto);
        return R.ok();
    }

    @PostMapping(value = "/multiple")
    public R<String> sendMultiple(@RequestBody Collection<ProbeDTO> dto) {
        probeService.batchSaveProbe(dto);
        return R.ok();
    }
}
